/**
 *
 * Copyright 2015-present reading
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
import { StackNavigator, TabNavigator } from 'react-navigation';
import Splash from '../pages/Splash';
// import CategoryContainer from '../containers/CategoryContainer';
import MainContainer from '../containers/MainContainer';
import WebViewPage from '../pages/ItemDetail/WebViewPage';
import SCRMWebContainer from '../containers/SCRMWebContainer';
import MsgContainer from '../containers/MsgContainer';
import Marketing from '../pages/Marketing/Marketing';
import VisitingCard from '../pages/VisitingCard/VisitingCard';
import TeamSettingContainer from '../containers/TeamSettingContainer';
import TeamProfileContainer from '../containers/TeamProfileContainer';
import MemberChoseContainer from '../containers/MemberChoseContainer';
import MyTeamContainer from '../containers/MyTeamContainer';
import LoginContainer from '../containers/LoginContainer';
import MyTeamSettingContainer from '../containers/MyTeamSettingContainer';
import MineContainer from '../containers/MineContainer';
import { Platform } from 'react-native';


import store from 'react-native-simple-store';


const TabContainer = TabNavigator(
  {
    Main: { screen: MainContainer },
    MSG: { screen: MsgContainer },
    // SCRM: { screen: CategoryContainer},
    Marketing: { screen: Marketing },
    Mine: { screen: MineContainer }
  },
  {
    // lazy: true,
    swipeEnabled: false,
    tabBarPosition: 'bottom',
    animationEnabled: false,
    tabBarOptions: {
      activeTintColor: '#3e9ce9',
      inactiveTintColor: '#999999',
      showIcon: true,
      style: {
        backgroundColor: '#fff',
        ...Platform.select({
          ios: {
          },
          android: {
            borderTopWidth: 1,
            borderTopColor: '#eeeeee',
          }
        })
      },
      indicatorStyle: {
        opacity: 0
      },
      tabStyle: {
        padding: 0,
        ...Platform.select({
          android: {
            paddingTop: 0,
          }
        })
      },
      labelStyle: {
        ...Platform.select({
          android: {
            margin: 6
          }
        })
      },
      iconStyle: {
        ...Platform.select({
          android: {
            height: 32,
            width: '100%',
            paddingTop: 0,
            // backgroundColor: 'lightblue'
          }
        })
      }
    }
  }
);

const App = StackNavigator(
  {
    Splash: { screen: Splash },
    Login: { screen: LoginContainer },
    // Category: {
    //   screen: CategoryContainer,
    //   navigationOptions: {
    //     headerLeft: null
    //   }
    // },
    Home: {
      screen: TabContainer,
      navigationOptions: {
        headerLeft: null
      }
    },
    Web: { screen: WebViewPage },
    Card: { screen: VisitingCard },
    scrm: {screen: SCRMWebContainer },
    TeamSetting: { screen: TeamSettingContainer },
    TeamProfile: { screen: TeamProfileContainer },
    MemberChose: { screen: MemberChoseContainer },
    MyTeam: { screen: MyTeamContainer },
    MyTeamSetting: { screen: MyTeamSettingContainer },
    // scrm: { 
    //   screen: SCRMWebViewPage
    // }r
  },
  {
    headerMode: 'screen',
    navigationOptions: {
      headerStyle: {
        backgroundColor: '#3e9ce9'
      },
      headerTitleStyle: {
        color: '#fff',
        fontSize: 20
      },
      headerTintColor: '#fff'
    }
  }
);

export default App;
